<template>
  <div class="group-table-box">
    <Row class="group-top">
      <Col span="16" class="group-top">
        <div class="input-item input-flex">
          <span>测评名称：</span>
          <Input v-model="form.groupName" placeholder="测评名称" style="width: 100px;" />
        </div>

        <div class="input-item input-flex">
          <span>所属活动：</span>
          <Input v-model="form.createName" placeholder="所属活动" style="width: 100px;" />
        </div>

        <div class="input-item input-flex">
          <span>创建时间：</span>
          <DatePicker
            v-model="form.date"
            type="daterange"
            format="yyyy-MM-dd"
            confirm
            placement="bottom-start"
            placeholder="创建时间"
            style="width: 200px"
            @on-change="onClickDatePickerChange"
          ></DatePicker>
        </div>

        <div class="input-item">
          <Button type="info" class="input-btn" @click="onClickSearch">搜索</Button>
          <Button type="warning" class="input-btn" @click="onClickReset">重置搜索</Button>
        </div>
      </Col>
    </Row>
    <div class="table-container">
      <Table
        border
        class="table-container-table"
        :columns="columns7"
        :data="tableData"
        :loading="isLoading"
      ></Table>
      <Page
        :total="totalPageCount"
        :current="form.pageIndex"
        :page-size="10"
        show-elevator
        class="table-container-page"
        @on-change="getTableData"
      />
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      isLoading: false,
      form: {
        pageIndex: 1,
      },
      totalPageCount: 10,
      columns7: [
        {
          title: '序号',
          type: 'index',
          align: 'center'
        },
        {
          title: '测评名称',
          key: 'groupName',
          align: 'center'
        },
        {
          title: '创建时间',
          width: 100,
          key: 'issueTime',
          align: 'center'
        },
        {
          title: '用户',
          key: 'userName',
          align: 'center'
        },
        {
          title: '所属活动',
          key: 'price',
          align: 'center'
        },
        {
          title: '是否精选',
          key: 'tagListLabel',
          align: 'center'
        },
        {
          title: '操作',
          key: 'action',
          width: 200,
          align: 'center',
          render: (h, params) => {
            return h('div', [
              h('Button', {
                props: {
                  type: 'primary',
                  size: 'small'
                },
                style: {
                  margin: '5px',
                  width: '70px'
                },
                on: {
                  click: () => {
                    this.check(params.index)
                  }
                }
              }, '查看测评'),
              h('Button', {
                props: {
                  type: 'success',
                  size: 'small'
                },
                style: {
                  margin: '5px',
                  width: '70px'
                },
                on: {
                  click: () => {
                    this.success(params.index)
                  }
                }
              }, '查看调研')
            ]);
          }
        }
      ],
      tableData: [{
        groupStatusText: '123123'
      }],
      checkReturnData: {
      }
    }
  },
  mounted() {
    this.getTableData();
  },
  watch: {
  },
  methods: {
    onClickSearch() {

    },
    onClickReset() {

    },
    onClickDeleteConfirm() {

    },
    check(index) {

    },
    success(index) {

    },
    remove(index) {

    },
    getTableData(index) {

    },
    onClickDatePickerChange(e) {
      // ["2018-08-07", "2018-09-12"]
      // this.form.date = e;
    },
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.input-flex {
  display: inline-flex !important;
  flex-direction: column;
}
.pull-right {
  float: right;
}
.group-table-box {
  padding: 20px;
}
.group-top {
  display: flex;
  align-items: flex-end;
}
.group-right {
  display: flex;
  justify-content: flex-end;
}
.input-item {
  display: inline-block;
  margin: 0 20px 20px 0;
  color: #000;
}
.input-btn {
  margin-right: 10px;
}
.table-container-page {
  text-align: center;
  margin-top: 20px;
  color: #000;
}
</style>
